#include "timeStamp.h"
#include "public.h"
#include <iostream>

TimeStamp::TimeStamp()
{
    m_secondSinceEpoch=0;
}
TimeStamp::TimeStamp(int64_t secondSinceEpoch)
{
    m_secondSinceEpoch=secondSinceEpoch;
}
std::string TimeStamp::ToString()
{
    struct tm t;
    char buff[SMALL_BUF_LEN]={0};
    snprintf(buff,SMALL_BUF_LEN,"[%04d/%02d/%02d %02d:%02d:%02d]",
    t.tm_year+1900,t.tm_mon+1,t.tm_mday,t.tm_hour,t.tm_min,t.tm_sec);
    return buff;
}
TimeStamp TimeStamp::Now()
{
    return TimeStamp(time(NULL));
}

